define(['models/record'], function(Record) {
  var RecordList = Backbone.Collection.extend({
    model: Record,
  	url: 'messages',

  	//localStorage: new Store('todos-backbone'),

  	completed: function() {
  		return this.filter(function(record) {
  			return record.get('completed');
  		});
  	},

  	remaining: function() {
  		return this.without.apply(this, this.completed());
  	},

  	nextOrder: function() {
  		if (!this.length) { return 1; }
  		return this.last().get('order') + 1;
  	},

  	comparator: function(record) {
  		return record.get('order');
  	}
  });

  return RecordList;
});
